
<!DOCTYPE html>
<html lang="en" class="no-js">

    <head>

        <meta charset="utf-8">
        <title>账号密码登录</title>

        <!-- CSS -->
        <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=PT+Sans:400,700'>
        <link rel="stylesheet" href="../css/reset.css">
        <link rel="stylesheet" href="../css/supersized.css">
        <link rel="stylesheet" href="../css/style.css">
        <script type="text/javascript" src="../js/jquery-3.2.1.js" ></script>

		<style>
			#dongtai:link {
				font-size: 2px;
				color: black;
				text-decoration: none;
				display: inline-block;
			}
			#dongtai:hover {
				color: #2EBFB1;
			}
			#error-message{
				color: red;
				font-family: "微软雅黑";
				font-size: 15px;
			}
		</style>
    </head>

    <body>

        <div class="page-container">
            <h1>登录</h1>
                <input type="text" name="empPhone" class="username" placeholder="手机"><br/>
                <input type="password" name="empPassword" class="password" placeholder="密码">
                <div id="error-message"></div>
                <div align="center" style="margin-left: 150px;padding-top: 10px;"><a href="user-login-phone.html" target="_self" id="dongtai">短信验证码登录</a></div>
                <button type="button" id="login">登录</button>
                <div class="error"><span>+</span></div>
            <div class="connect">
                <p>或者联系:</p>
                <p>
                    <a class="facebook" href="http://www.mylianshu.com/"></a>
                    <a class="twitter" href="http://www.twitter.com"></a>
                </p>
            </div>
        </div>

        <!-- Javascript -->
        <script src="../js/jquery-1.8.2.min.js"></script>
        <script src="../js/supersized.3.2.7.min.js"></script>
        <script src="../js/supersized-init.js"></script>
        <script src="../js/scripts.js"></script>

    </body>
	<script type="text/javascript">
		$(function(){
			$('#login').bind('click',function(){
				$.ajax({
				   type: "POST",
				   url: getPath()+"/employee",
				   data: ({
					    'type':'login',
						'empPhone':$('input[name="empPhone"]').val(),
						'empPassword':$('input[name="empPassword"]').val(),
				   }),
				   dataType:'json',
				   success: function(data){
					  if(data.result == 'success'){
					  	window.location.href=getPath()+"/fram/layout.html";
					  }else{
					  	$('#error-message').text(data.message);
					  	$('input[name="empPhone"]').val('');
						$('input[name="empPassword"]').val('');
					  }
				   }
				});
			});
			
			
			
			
			
		});
		/**
		 * 获取当前项目名
		 */
		function getPath(){
			var pathName=window.document.location.pathname;
			var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); 
			return projectName;
		}
	</script>
</html>

